{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "trained-settlement",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/flipping-an-image\n",
    "\n",
    "\n",
    "Runtime: 4 ms, faster than 86.21% of C++ online submissions for Flipping an Image.\n",
    "Memory Usage: 8.7 MB, less than 91.84% of C++ online submissions for Flipping an Image.\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <vector>\n",
    "#include <algorithm>\n",
    "#include <iostream>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {\n",
    "        //7:04\n",
    "        for (int j=0; j < image.size(); j++) {\n",
    "            auto row = image[j];\n",
    "            reverse(row.begin(), row.end());\n",
    "            for (int i=0; i<row.size(); i++) {\n",
    "                if (row[i] == 0) {\n",
    "                    row[i] = 1;\n",
    "                } else {\n",
    "                    row[i] = 0;\n",
    "                }\n",
    "            }\n",
    "            image[j] = row;\n",
    "        }\n",
    "        return image;\n",
    "        //7:09\n",
    "    }\n",
    "};\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "boxed-bleeding",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
